﻿function rechargeCtrl($scope,$http) {
    $scope.user = 'kibamaple';
    $scope.user_format = /^[a-zA-Z0-9]*$/;
    $scope.notexists = false;
    $scope.exists = function () {
        $http.get('/account/verifyaccount/' + $scope.user).success(
		    function (data, status) {
		        $scope.notexists = data == "False";
		    }).error(function (data, status) {
		        $scope.notexists = true;
		});
	};

	$scope.amount_format = /^[0-9]*$/;
	$scope.confirmuser = function () {
	    $scope.confirmfailed = $scope.confirm != $scope.user;
	};

	$scope.submit = function () {
	    $scope.action = $scope.region.value;
	};

	$scope.newverifycode = function () {
	    $scope._time = '?'+(new Date()).getTime().toString();
	};

	$scope.games = [
        { name: '斗破苍穹', regions: [
            { name: '1区', value: '/DPCQ001/taobao/new',exchange:100},
            { name: '2区', value: 'DPCQ002/taobao/new',exchange:10}
        ]},
        { name: 'test1', regions: [
            { name: '4区', value: 'test001/taobao/new',exchange:100},
            { name: '5区', value: 'test002/taobao/new',exchange:1000 }
        ]
        }
    ];

	$scope.game = $scope.games[0];

    $scope.lang = {
        user_required: '*',
        user_min: '少于6位',
        user_max: '大于16位',
        user_pattern: '格式错误',
        user_not_exists:'不存在',
        confirm_required: '*',
        confirm_failed:'与充值帐号不符',
        amount_required: '*',
        amount_min: '小于1',
        amount_max:'大于10000',
        amount_format:'格式错误',
        verifycode_required:'*',
        region_required:'*'
    };
}

function setTab(name, cursel, n) {
    for (var i = 1; i <= n; i++) {
        var menu = document.getElementById(name + i);
        var con = document.getElementById("con_" + name + "_" + i);
        menu.className = i == cursel ? "hover" : "";
        con.style.display = i == cursel ? "block" : "none";
    }
}